package org.yu.register.capability;

import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityProvider;
import net.minecraftforge.common.util.INBTSerializable;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.common.util.NonNullSupplier;
import org.yu.register.CapabilityRegister;

import javax.annotation.Nonnull;

public class MultiDustCapabilityProvider extends CapabilityProvider<MultiDustCapabilityProvider>  {
    private final LazyOptional<MultiDustCapability> capability;

    public MultiDustCapabilityProvider(NonNullSupplier<MultiDustCapability> supplier) {
        super(MultiDustCapabilityProvider.class);
        capability = LazyOptional.of(supplier);
    }


    @Nonnull
    @Override
    public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, Direction side) {
        return CapabilityRegister.MULTI_DUST.orEmpty(cap, capability.cast());
    }
}
